﻿CREATE FUNCTION [dbo].[fn_Columns]
(
	@Table sysname
)
RETURNS @Columns TABLE (ColumnName sysname)
AS
BEGIN
	INSERT INTO @Columns (ColumnName)
	SELECT ColumnName
	FROM   dbo.fn_ColumnsAll(@Table)
	WHERE  ColumnName NOT IN (SELECT fhc.ColumnName
	                          FROM   dbo.fn_HousekeepingColumns() fhc)
	
	RETURN
END